﻿using ArtMath.Attribute;
using ArtMath.Component.Polygon;
using ArtMath.Core.Data;
using ArtMath.Data;
using System;
using System.ComponentModel;

namespace ArtMath.Component.Circle
{
    /// <summary>
    /// 构造圆基类
    /// </summary>
    [Serializable]
    public abstract class ConstructedCircleBase : FullCircleBase
    {
        LineBase line;
        protected PointD? newCenter, newPcenter;
        protected double? newRadius;
        public ConstructedCircleBase(SketchPad pad, string name, LineBase line, ToolTypeName toolType, bool addToList = true) : base(pad, name, toolType, addToList)
        {
            Line = line;
        }
        [MultilingualCategory("Structure"), TypeConverter(typeof(ExpandableObjectConverter))]
        public virtual LineBase Line
        {
            get { return line; }
            set
            {
                line?.OutChildren_Line.Remove(this);
                line = value;
                line?.OutChildren_Line.Add(this);
            }
        }
        [Browsable(false)]
        public override RPointS RotateCenter
        {
            get
            {
                return base.RotateCenter;
            }

            set
            {
                base.RotateCenter = value;
            }
        }
        [Browsable(false)]
        public override AngleStringX RotateAngle
        {
            get
            {
                return base.RotateAngle;
            }

            set
            {
                base.RotateAngle = value;
            }
        }
        public override void CreateComponents()
        {
            ComponentChanged(Line);
            base.CreateComponents();
        }
    }
}
